package com.zrrd.javaSEPlus._04_reflect;

/**
 * @author WanJl
 * @version 1.0
 * @title Reflect
 * @description
 * @create 2023/11/12 11:30
 */
public class ReflectClass {
    public static void main(String[] args) throws ClassNotFoundException {
        //1.通过Class类中的forName(类全名)方法获取Class对象
        Class clazz = Class.forName("com.zrrd.javaSEPlus._04_reflect.Student");
        System.out.println(clazz);
        //2.通过class属性来获取
        Class<Student> clazz02 = Student.class;
        System.out.println(clazz02);

        //3.通过对象的getClass方法来获取class对象
        Student student = new Student();
        Class<? extends Student> clazz03 = student.getClass();
        System.out.println(clazz03);

        System.out.println(clazz==clazz02);
        System.out.println(clazz02==clazz03);
        System.out.println(clazz03==clazz);
        System.out.println(clazz.equals(clazz03));
        System.out.println(clazz.equals(clazz02));


    }
}
